import socket
from DesModule import des_encrypt, des_descrypt

tcpclient = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tcpclient.connect(("172.16.208.141", 2028))
KEY = "12345678"  # 保证KEY长度为8

data = input('>>> ').strip()
encrypted_data = des_encrypt(data, KEY)
tcpclient.send(encrypted_data.encode('utf-8'))
ret = tcpclient.recv(1024)
decrypted_response = des_descrypt(ret.decode('utf-8'), KEY)
print("Server replied:", decrypted_response)

tcpclient.close()